import PyPDF2
import sys

try:
    output = sys.argv[1]
    files = sys.argv[2:]
except:
    output = input("输出的文件路径：").strip()
    files = []
    for cnt in range(1, 65536):
        input_file = input("第{}个输入文件的路径，输入空行结束：".format(cnt)).strip()
        if input_file == "":
            break
        else:
            files.append(input_file)

merger = PyPDF2.PdfMerger()
for i in files:
    merger.append(i)
merger.write(output)
